//=============================================================================
// Global Logging Object
//  Only access the external reference through the macros
//  LOG_*
//
// Define NDEBUG to get rid of logging messages.
// 
//
// Bodhi Crandall-Rus (boder.us)
// Sept 10, 2006
//=============================================================================

#ifndef LOG_H
#define LOG_H

#ifndef NDEBUG

#include <fstream>

namespace KEG
{

class Logger
{
public:
	void Init( const char* );
	void Write( const char* , const char* , int );
	void Warn( const char* , const char* , int );
	void Error( const char* , const char* , int );
	std::ostream& Raw() { ofs << "....."; return ofs; }

private:
	std::ofstream ofs;
};

extern Logger MainLog;

}

#define LOG_INIT(X)  KEG::MainLog.Init( X )
#define LOG_INFO(X)  KEG::MainLog.Write( X, " (" __FILE__ ": " , __LINE__  )
#define LOG_WARN(X)  KEG::MainLog.Warn( X, " (" __FILE__ ": " , __LINE__  )
#define LOG_ERROR(X) KEG::MainLog.Error( X, " (" __FILE__ ": " , __LINE__  )
#define LOG_RAW()    KEG::MainLog.Raw()

#else

#define LOG_INIT //
#define LOG_INFO //
#define LOG_WARN //
#define LOG_ERR //
#define LOG_RAW() //

#endif

#endif
